package ru.spb.nicetu.altx.mnemo.messages;

import java.util.ArrayList;

import org.eclipse.core.resources.IProject;

import ru.spb.nicetu.altx.mnemo.node.INode;

public class RunMessage {
  public enum RunMessageType {
    ERROR, WARNING, MESSAGE, DEBUG,
  }

  private String message;
  private RunMessageType type;
  private ArrayList<String> cellIDs = new ArrayList<String>();
  private INode node;
  private IProject project;

  public RunMessage(String msg, String[] cellIDs, RunMessageType type) {
    this.message = msg;
    this.type = type;
    if (cellIDs != null) {
      for (int i = 0; i < cellIDs.length; i++) {
        this.cellIDs.add(cellIDs[i]);
      }
    } else {
      this.cellIDs = new ArrayList<String>();
    }
  }

  public RunMessage(String msg, String[] cellIDs) {
    this(msg, cellIDs, RunMessageType.MESSAGE);
  }

  public RunMessage(String msg) {
    this(msg, null, RunMessageType.MESSAGE);
  }

  public RunMessageType getType() {
    return type;
  }

  public String getMessage() {
    return message;
  }

  public void setMessage(String str) {
    this.message = str;
  }

  public String[] getCellIDs() {
    return cellIDs.toArray(new String[0]);
  }

  public void setCellIDs(String[] cellIDs) {
    this.cellIDs.clear();
    for (int i = 0; i < cellIDs.length; i++) {
      this.cellIDs.add(cellIDs[i]);
    }
  }

  public INode getNode() {
    return node;
  }

  public void setNode(INode node) {
    this.node = node;
  }

  public void setProject(IProject project) {
    this.project = project;
  }

  public IProject getProject() {
    return project;
  }

}
